package com.server.controller;

import com.server.service.*;
import com.server.utils.GlobalUtils;
import com.server.utils.LogUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

//@RestController
//@Component
public class AutoController {
    /*
    cron = "* /30 * * * * ?"
    第一个星号代表秒，* 表示每秒钟，30：表示每30秒触发一次。这里的*代表秒，* /30表示每隔30秒
    第二个星号代表分钟，* 表示每分钟。
    第三个星号代表小时，* 表示每小时。
    第四个字段代表日期，* 表示每天。
    第五个字段代表月份，* 表示每个月。
    第六个字段代表星期几，? 表示不指定星期几。
    */
    // 自动化
    // 频率：每天每小时自动执行
    @Resource
    AutoService autoService;
    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void ReservoirTemperatureAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("环境温度更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateReservoirTemperature();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterAsAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("砷含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterAs();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterBod5AutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("五日生化需氧量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterBod5();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterC2n2AutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("氰化物含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterC2n2();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterC6h5ohAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("挥发酚含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterC6h5oh();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterCdAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("镉含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterCd();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterCodAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("化学需氧量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterCod();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterColiGroupAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("粪大肠杆菌群更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterColiGroup();
    }


    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterConductivityAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("电导率更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterConductivity();
    }


    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterCrAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("铬含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterCr();
    }


    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterCuAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("铜含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterCu();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterDissolvedOxygenAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("氧溶解量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterDissolvedOxygen();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterEntireNAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("总氨量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterEntireN();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterEntirePAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("总磷量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterEntireP();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterFAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("氟化物含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterF();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterHgAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("汞含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterHg();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterLasAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("阴离子表面活性剂含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterLas();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterMno4AutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("高锰酸盐含量指数更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterMno4();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterNh3nAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("氨氨量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterNh3n();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterPbAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("铅含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterPb();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterPetroleumAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("石油类含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterPetroleum();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterPhAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("pH值更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterPh();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterSAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("硫化物含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterS();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterSeAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("硒含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterSe();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterTemperatureAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("水温更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterTemperature();
    }

    @Async
    @Scheduled(cron = "* 0,5,10,15,20,25,30,35,40,45,50,55 * * * *")
    public void WaterZnAutoGenerator() throws Exception {
        // 环境温度监测
        LogUtils.INFO.info("锌含量更新：{}", GlobalUtils.getCurrentTime());
        autoService.updateWaterZn();
    }
}